Native Image Generator
   HOME

TheInfoList



OR:

The Native Image Generator, or simply NGen, is the ahead-of-time compilation (AOT) service of the
.NET Framework The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
. It allows a CLI assembly to be pre-compiled instead of letting the Common Language Runtime (CLR) do a
just-in-time compilation In computing, just-in-time (JIT) compilation (also dynamic translation or run-time compilations) is a way of executing computer code that involves compilation during execution of a program (at run time) rather than before execution. This may cons ...
(JIT) at runtime. In some cases the execution will be significantly faster than with JIT.


General information

The Native Image Generator produces a native binary image for the current environment (i.e.; operating systems). This eliminates the JIT overhead at the expense of portability and disk space; whenever an NGen-generated image is run in an incompatible environment, .NET Framework automatically reverts to using JIT. Once NGen is run against an assembly, the resulting native image is placed into the Native Image Cache (NIC) for use by all other CLI assemblies. This makes it possible, for example, to use NGen to process CLI assemblies at installation time, saving processor time later on, when the end-user invokes the application on their system. NGen is intended to make the assembly execute faster by removing the JIT compilation process at runtime, but this does not always improve performance because some optimizations can be done only by a JIT compiler (e.g., if the JIT compiler knows that the code is already running with full trust, it can skip certain expensive security checks). Because of this fact, it makes sense to use NGen only after benchmarking the application performance before and after it.


See also

* Common Language Infrastructure (CLI) *
Common Intermediate Language Common Intermediate Language (CIL), formerly called Microsoft Intermediate Language (MSIL) or Intermediate Language (IL), is the intermediate language binary instruction set defined within the Common Language Infrastructure (CLI) specification. ...
(CIL) *
Global Assembly Cache The Global Assembly Cache (GAC) is a machine-wide CLI assembly cache for the Common Language Infrastructure (CLI) in Microsoft's .NET Framework. The approach of having a specially controlled central repository addresses the flaws in the shared lib ...
(GAC) * CoreRT


External links


Common Language Infrastructure (Standard ECMA-335)

“ECMA C# and Common Language Infrastructure Standards” on MSDN

Speed: NGen Revs Up Your Performance With Powerful New Features -- MSDN Magazine, April 2005
{{Microsoft development tools .NET